package com.tencent.ied.bk.config;

import com.tencent.ied.bk.filter.*;
import com.tencent.ied.bk.filter.impl.EmptyFilter;
import com.tencent.ied.bk.filter.impl.SizeFilter;
import com.tencent.ied.bk.filter.impl.WordLengthFilter;
import com.tencent.ied.bk.filter.impl.WordNumFilter;
import com.tencent.ied.bk.handler.*;
import com.tencent.ied.bk.handler.impl.*;

/**
 * @author chen_yu
 * @date 2021/3/11 5:38
 */
public class ChainConfig {

    /**
     * 过滤器链
     */
    public static FilterChain filterChain;
    /**
     * 处理器链
     */
    public static HandlerChain handlerChain;

    //模拟启动初始化工作
    static {
        filterChain = new FilterChain();
        filterChain.addFilter(new EmptyFilter("输入非空判断过滤器"))
                .addFilter(new SizeFilter("摘要集合大小判断过滤器"))
                .addFilter(new WordNumFilter("单词数量过滤器"))
                .addFilter(new WordLengthFilter("单词长度过滤器"));

        //处理器类的初始化
        handlerChain = new HandlerChain();
        handlerChain.addHandler(new DataReadyHandler())
                .addHandler(new FirstContainsHandler())
                .addHandler(new SearchKeyWordHandler())
                .addHandler(new ContainsKeyWordHandler())
                .addHandler(new SortHandler())
                .addHandler(new PrintHandler())

        ;

    }


}
